<extend name="Public/base"/>

<block name="body">
    <form method="POST" id="form1" action="">
        <div class="main-title">
            <h2>门店每日进销统计</h2>
            <div style="color: red;">注意：该数据统计时间最早起始于2016-09-01</div>
        </div>
        <div class="navbar navbar-default" style="margin: 0px;">

            <!-- 高级搜索 -->
            <div class="search-form " style="margin-top: 10px;margin-left: 10px;">
                <div class="sleft">
                    日期：
                    <input type="text" name="startDate" class="text input-large time" value="{$startTime}" placeholder="请选择统计日期"   style="height: 30px;width:120px" />
                    到：
                    <input type="text" name="endDate" class="text input-large time" value="{$endTime}" placeholder="请选择统计日期"   style="height: 30px;width:120px" />
                </div>
                <div class="sleft">
                    <a class="sch-btn" href="javascript:;" id="search" url="{:U('')}"><i class="btn-search"></i></a>
                </div>
            </div>
        </div>

        <div class="data-table table-striped">
            <table>
                <thead>
                <tr>
                    <th>门店</th>
                    <th>进货总价</th>
                    <th>销售总价</th>
                </tr>
                </thead>
                <tbody>
                <notempty name="_list">
                    <volist name="_list" id="vo">
                        <tr>
                            <td>{$vo.name} </td>
                            <td>
                                <if condition="$vo.sumin eq null ">0
                                    <else /><a href="{:U('SpReport/jinhuodetail?id='.$vo['id'].'&todaytest='.$vo['todaytest'].'&tomorrowtest='.$vo['tomorrowtest'])}">{$vo.sumin}</a>
                                </if>
                            </td>
                            <td><a href="{:U('SpReport/xiaoshoudetail?id='.$vo['id'].'&todaytest='.$vo['todaytest'].'&tomorrowtest='.$vo['tomorrowtest'])}">{$vo.sumout}</a></td>
                            <!--<td><a href="{:U('Sort/planbyday',array('aday'=>$vo['aday']))}" class="btn btn-success">明细</a></td>-->
                        </tr>
                    </volist>
                    <else/>
                    <td colspan="5" class="text-center"> aOh! 暂时还没有内容! </td>
                </notempty>
                </tbody>
            </table>
        </div>
        <div class="page">
            {$_page}
        </div>
    </form>
</block>

<block name="script">
    <script type="text/javascript">

        $(function () {
            $('.time').datetimepicker({
                format: 'Y-m-d',
                language: "zh-CN",
                minView: 2,
                autoclose: true
            });
        });

        $("#search").click(function () {
            var url = $(this).attr('url');

            var query = $('.search-form').find('input').serialize();
            var queryselect = $('.search-form').find('select').serialize();

            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
            query = query.replace(/^&/g, '');
            queryselect = queryselect.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
            queryselect = queryselect.replace(/^&/g, '');

            if (url.indexOf('?') > 0) {
                url += '&' + query;
                url += '&' + queryselect;
            } else {
                url += '?' + query;
                url += '?' + queryselect;
            }

            window.location.href = url;
        });
        //回车搜索
        $(".search-input").keyup(function (e) {
            if (e.keyCode === 13) {
                $("#search").click();
                return false;
            }
        });
        highlight_subnav('{:U('spreport/invoicing')}');
    </script>
</block>